#include "IntegerToken.h"
#include <sstream>
#include "VccException.h"

IntegerToken::IntegerToken(string text) : Token(text), integer_value(0xDEADBEEF) {
    stringstream ss(this->get_text());
    if (!(ss >> this->integer_value)) {
        throw VccException("failed to convert to integer: " + this->get_text());
    }
}

IntegerToken::~IntegerToken() {
    // empty
}

int IntegerToken::get_integer() {
    return this->integer_value;
}
